package com.example.demo.common.code;

public enum BasicCode {
    SUCCESS("10000", "成功", ExecuteFlag.S),
    SERVICE_IN_PROGRESS("20000", "服务处理中", ExecuteFlag.P),
    SERVICE_ERROR("30000", "服务异常", ExecuteFlag.F),
    SERVICE_INSUFFICIENT_PERMISSION("40000", "服务权限不足", ExecuteFlag.F),
    PARAMS_MISSING("51000", "缺少必选参数", ExecuteFlag.F),
    PARAMS_INVALID("52000", "无效的参数", ExecuteFlag.F),
    BIZ_ERROR("60000", "业务处理失败", ExecuteFlag.F),
    TINY_BOOT_ERROR("70000", "微平台错误", ExecuteFlag.F),
    ALREADY_EXIT("80000","已存在",ExecuteFlag.F);
    private String code;
    private String codeDesc;
    private ExecuteFlag flag;

    private BasicCode(String code, String desc, ExecuteFlag flag) {
        this.code = code;
        this.codeDesc = desc;
        this.flag = flag;
    }

    public static BasicCode getByCode(String code) {
        BasicCode[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            BasicCode param = var1[var3];
            if (param.getCode().equals(code)) {
                return param;
            }
        }

        return null;
    }

    public String getCode() {
        return this.code;
    }

    public String getCodeDesc() {
        return this.codeDesc;
    }

    public ExecuteFlag getFlag() {
        return this.flag;
    }
}
